package studychinese.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;

import com.hschinese.pronunciation.R;
import com.hschinese.pronunciation.activity.MyApplication;
import com.jaeger.library.StatusBarUtil;


/**
 * Created by Administrator on 2016/3/15.
 */
public abstract class BaseAcitivity extends AppCompatActivity {

    private int mAlpha;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        MyApplication.getInstance().pushAty(this);
        setContentView(setContainer());//
        registerReceiver();//注册广播
        registerEventBus();
        innitView();
         setWindow();
        loadData();
    }

    @Override
    public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);
        setStatusBar();
    }

    protected void setStatusBar() {
        StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));
    }

    protected  void setWindow(){

    }




    protected void onResume() {
        super.onResume();

    }
    protected void onPause() {
        super.onPause();

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        destoryReceiver();
        destoryEventBus();

    }




    /**
     * 设置布局
     *
     * @return 布局layout
     */
    protected abstract int setContainer();

    /**
     * 初始化界面控件
     */
    public abstract void innitView();

    /**
     * 注册广播
     */
    public void registerReceiver() {
    }

    /**
     * 销毁广播
     */
    public void destoryReceiver() {
    }

    /**
     * 注册eventbus
     */
    public void registerEventBus() {
    }

    /**
     * 销毁eventBus
     */
    public void destoryEventBus() {
    }


    /**
     * 加载数据
     */
    public void loadData() {

    }






}
